# 服务端
import json

import DID_interface

serve_did="did:p2p_did_chat:Yk6hiAdlTA"
port=8800
if DID_interface.DID_listen(serve_did, port):
    conn, client_addr = DID_interface.DID_accept()
    print("等待接收数据")
    received_data = DID_interface.DID_recv()
    print("收到",received_data)
    data={ "type": "text",
           "content": "你好！" ,
           "timestamp": "2025-07-10T10:30:00"}

# response = {"status": "ok"}
    if DID_interface.DID_send(data):
        print("已发送响应")

DID_interface.DID_close()